package cn.fintecher.pangolin.service.dataimp.web;

import cn.fintecher.pangolin.common.enums.StrategyType;
import cn.fintecher.pangolin.common.web.BaseController;
import cn.fintecher.pangolin.service.dataimp.service.StrategyDistributeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther: xiaqun
 * @Description: 策略分案相关接口
 * @Date: 16:36 2019/9/16
 */

@RestController
@RequestMapping("/api/strategyDistributeController")
@Api(value = "策略分案相关接口", description = "策略分案相关接口")
public class StrategyDistributeController extends BaseController {
    @Autowired
    private StrategyDistributeService strategyDistributeService;

    /**
     * 手动执行策略分案
     */
    @ApiOperation(value = "手动执行策略分案", notes = "手动执行策略分案")
    @GetMapping("/manualExecuteStrategy")
    public ResponseEntity<Void> manualExecuteStrategy(@RequestParam @ApiParam(value = "策略类型", required = true) StrategyType type,
                                                      @RequestHeader(value = "X-UserToken") String token) {
        log.info("REST request to manual execute strategy,{}", type);
        strategyDistributeService.manualExecuteStrategy(type, token);
        return ResponseEntity.ok().build();
    }
}